const app = getApp();
import { baseUrl } from "../../../api/request"
import { msgInfo } from "../../../api/news"
Page({
    data: {
        navData: {
            level: 2,
            title: "消息详情"
        },
        imgUrl: baseUrl,
        detailObj: {},
        navMargin: app.globalData.navHeight + app.globalData.navTop,
    },
    onLoad(options) {
        app.globalData.newsId = options.id;
        app.globalData.newsFlag = true;
        this.getInfo(options.id);
    },
    onShow() {

    },
    //获取详情信息
    getInfo(id) {
        msgInfo({ msgId: id }).then(res => {
            this.setData({
                detailObj: res.data.data,
            });
            console.log(this.data.detailObj, 'detailObj');
        });
    },
    listClick(e) {
        const item = e.currentTarget.dataset.item;
        if (item.state === 1) {
            if (item.flag === 1) {
                wx.navigateTo({
                    url: '/pagesShouYe/pages/listDetail/index?id=' + item.dynamicId,
                });
            } else {
                wx.redirectTo({
                    url: '/pages/index/index?index=' + 5,
                });
            };
        } else {
            wx.navigateTo({
                url: '/pagesShouYe/pages/bnnerDetailMore/index?id=' + item.activityId,
            });
        };
        console.log(item, 'item');

    },
    onReady() {

    },
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {

    }
})